import time
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By


# https://developer.chrome.com/docs/chromedriver/downloads?hl=zh-cn
def main():
    chrome_options = webdriver.ChromeOptions()
    service = Service(executable_path='./chromedriver.exe')
    driver = webdriver.Chrome(service=service, options=chrome_options)
    driver.get("https://www.baidu.com")
    element = driver.find_element(By.ID, 'kw')
    print(element)
    element.send_keys('五一热门景点')
    # 百度一下的 id 为 su,然后点击进行搜索
    driver.find_element(By.ID, 'su').click()
    time.sleep(10)
    # 关闭浏览器
    driver.close()


if __name__ == '__main__':
    main()
